{% extends 'Base/main.content.lists.div.html.twig' %}{% import 'Base/list_item.twig' as listItem %}
{% block options %}
    <div class="menu-list">
        {#{{ dump(tools) }}#}
        {% for key , classes in tools %}
            {% set default = "请选择分类" %}
            {% set classes = classes %}
            <div class="rule-single-select">
                <select name="cond[{{ key }}]" onchange="javascript:__doPostBack('searchCond','')" >
                    <option value="" {{app.request.get("cond")[key] is defined and app.request.get("cond")[key] == "" ? ' selected="selected"' : "" }} >{{ default }}</option>
                    {% for class in classes %}
                        <option
                                value="{{ class.id }}"
                                {{app.request.get("cond")[key] is defined and  app.request.get("cond")[key] == class.id ? ' selected="selected"' : "" }}
                                >
                            {{ class.name }}
                        </option>
                    {% endfor %}
                </select>
            </div>
        {% endfor %}
    </div>
{% endblock %}
{% block tableHead %}
    <tr>
        <th width="3%">选择</th>
        <th align="center" width="6%">#</th>
        <th align="left">说明</th>
        <th align="left" width="10%">分类</th>
        <th align="left">内容</th>
        <th align="left" width="10%">排序</th>
        <th align="center" width="10%">管理</th>
    </tr>
{% endblock %}
{% block tableList %}
    {#{{ dump(lists) }}#}
    {% for Entity in lists %}
        <tr>
            <td align="center">
                <span class="checkall" style="vertical-align:middle;">
                    <input lay-skin="primary" type="checkbox" name="ids[]" value="{{ Entity.PlatConfig_id }}"/>
                </span>
            </td>

            <td align="center">{{ Entity.PlatConfig_id }}</td>
            <td align="left">{{ Entity.PlatConfig_tips }}</td>
            <td align="left">
                {{ Entity.B_name }}
            </td>
            <td align="left">
                {% if Entity.A_link == "txt" %}
                    <p>{{ Entity.PlatConfig_text }}</p>
                {% endif %}
                {% if Entity.A_link == "pic" %}
                    <img src="{{ Entity.PlatConfig_pic }}" alt="" style="max-width: 100px; max-height:100px;" />
                {% endif %}
                {% if Entity.A_link == "rich" %}
                    <a class="see">查看</a>
                    <div id="see_{{ Entity.PlatConfig_id }}" style="width: 600px;" class="hidden">
                        {{ Entity.PlatConfig_article | raw }}
                    </div>
                {% endif %}
            </td>

            <td align="left">
                <input
                        id="val_orders_{{ Entity.PlatConfig_id }}"
                        type="text" value="{{ Entity.PlatConfig_orders }}"
                        class="layui-input"
                        onkeydown="return checkNumber(event);"
                        onblur="__doPostBack('setAttr','id={{ Entity.PlatConfig_id }}&orders='+ $('#val_orders_{{ Entity.PlatConfig_id }}').val())"
                        >
            </td>

            <td align="center">
                <a href="{{ path("PlatConfigPreEdit",{'id':Entity.PlatConfig_id}) }}" class="layui-btn layui-btn-normal layui-btn-sm"><span class="fa fa-edit c13"></span></a>
            </td>
        </tr>
    {% endfor %}
{% endblock %}
{% block myJs %}
    <script>
        var layer = layui.layer;
//        layer.msg("test")
        $(function () {
            $(".see").click(function () {
                var id = $(this).siblings().attr("id")
//                layer.msg("test" + id)
                layer.open({
                    type:1,
                    content: $('#' + id),
                    area: ['600px','600px'],
                    cancel: function(index, layero){
                        layer.close(index)
                        $('#' + id).hide()
                        return false;
                    }
                })
            })
        });
    </script>
{% endblock %}

